package com.ymttest.database.mongo.jproduct;

import java.util.ArrayList;
import java.util.Map;

import com.ymt.database.MongoDBDriver;
import com.ymttest.database.mongo.YmtMongoDriverFactroy;

public class GrouponProductsWapper {
	private MongoDBDriver mdd = YmtMongoDriverFactroy.getInstance_YmtProductDBdriverNewJava("GrouponProducts");
	
	public Map<String,Object> getByProductId(String productId) throws Exception {
		ArrayList<Map> list = mdd.selectPartLimitToMap("{\"spid\":\"" + productId + "\"}",1);
	    return list.size()>0?list.get(0):null;
	}
	
	public Map<String,Object> getByVersion(long version) throws Exception {
		ArrayList<Map> list = mdd.selectPartLimitToMap("{\"ver\": "+version+" }",1);
	    return list.size()>0?list.get(0):null;
	}
}
